package com.itheima.day05_method;

import java.io.PrintStream;

public class Demo6_Test {
    public static void main(String[] args) {
        int[] arr = {10, 20, 30, 40};
        printArray(arr);
        System.out.println();
        int[] arr2 = null;
        printArray(arr2);
        System.out.println();
        int[] arr3 = {};
        printArray(arr3);
    }

    public static void printArray(int[] arr){
        if (arr == null){
            System.out.print("arr = " + arr);
            return;
        }
        System.out.print("[");
        for (int i = 0; i < arr.length; i++) {
            if (i == arr.length -1){
                System.out.print(arr[i]);
            }else{
                System.out.print(arr[i] + ",");
            }
        }
        System.out.print("]");
    }
}
